﻿using System;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace NAGFwk.UI
{
    public partial class ErrorForm : XtraForm
    {
        public ErrorForm(string errorMessage, string errorTitle)
        {
            InitializeComponent();
            meError.Text = string.Format("{0}:{1}", errorTitle, errorMessage);
            StartPosition = FormStartPosition.CenterScreen;
        }

        public ErrorForm(Exception ex)
        {
            InitializeComponent();

            if (ex.InnerException == null)
                meError.Text = string.Format("{0}:{1}", ex.Message, "Excepción");
            else if (ex.InnerException.InnerException == null)
                meError.Text = string.Format("{0}:{1}", ex.InnerException.Message, "Excepción");
            else
                meError.Text = string.Format("{0}:{1}:", ex.InnerException.Message, "Excepción", ex.InnerException.InnerException.Message);
        }

        private void continueSimpleButton_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
    }
}
